/** @file MainToolbar.qml
@brief The Main toolbar.

@authorname \n
@licenseversion \n
@actualversion - @dateupdate

@licensenote
*/
import QtQuick 1.0
import com.nokia.symbian 1.0
import "QtComplex" as Framework
import "QtComplex/Tools.js" as QTCtools

// Main toolbar
Flickable {
    id: flick_toolbar
    width: parent.width
    height: parent.height
    clip: true
    anchors.fill: parent
    flickableDirection: Flickable.HorizontalFlick
    contentWidth: QTCtools.getToolbarWidth(main_toolbar.obj_buttons,
                                           parent.width,
                                           QTCtools.getButtonSize(QTCtools.getToolbarHeight(parent.height)))
    contentHeight: QTCtools.getToolbarHeight(parent.height)

    signal toolbarEvent(int button)

    Framework.QTCtoolbar {
        id: main_toolbar

        property int buttonSize: QTCtools.getButtonSize(height)
        property string buttonName: QTCtools.getButton("dark")
        property int obj_buttons: 13

        width: QTCtools.getToolbarWidth(obj_buttons, parent.width, buttonSize)
        height: flick_toolbar.contentHeight // QTCtools.getToolbarHeight(parent.height)
        anchors.top: parent.top
        obj_color: QTCtools.black;           // Toolbar background color

        Row {
            id: tb_buttons
            height: main_toolbar.buttonSize; anchors.left: parent.left
            anchors.leftMargin: Math.round(QTCtools.tb_btnSpacer * main_toolbar.buttonSize)
            anchors.verticalCenter: parent.verticalCenter
            spacing: Math.round(QTCtools.tb_btnSpacer * main_toolbar.buttonSize)

            Framework.QTC_GroupLoader {
                id: tb_btn1
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: main_toolbar.buttonName; obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("cat")
                obj: "QTCtoolbarbutton"
                onClicked: {
                    console.log("cat")
                    flick_toolbar.toolbarEvent(1)
                }
            }

            Framework.QTC_GroupLoader {
                id: tb_ghost1
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: QTCtools.getButton("ghost")
                enabled: false
                obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("ghost")
                obj: "QTCtoolbarbutton"
            }

            Framework.QTC_GroupLoader {
                id: tb_ghost2
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: QTCtools.getButton("ghost")
                enabled: false
                obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("ghost")
                obj: "QTCtoolbarbutton"
            }

            Framework.QTC_GroupLoader {
                id: tb_ghost3
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: QTCtools.getButton("ghost")
                enabled: false
                obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("ghost")
                obj: "QTCtoolbarbutton"
            }

            Framework.QTC_GroupLoader {
                id: tb_btn2
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: main_toolbar.buttonName; obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("drawing")
                obj: "QTCtoolbarbutton"
                onClicked: {
                    console.log("drawing")
                    flick_toolbar.toolbarEvent(2)
                }
            }

            Framework.QTC_GroupLoader {
                id: tb_btn3
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: main_toolbar.buttonName; obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("cut")
                obj: "QTCtoolbarbutton"
                onClicked: {
                    console.log("cut")
                    flick_toolbar.toolbarEvent(3)
                }
            }

            Framework.QTC_GroupLoader {
                id: tb_btn4
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: main_toolbar.buttonName; obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("tools")
                obj: "QTCtoolbarbutton"
                onClicked: {
                    console.log("tools")
                    flick_toolbar.toolbarEvent(4)
                }
            }

            Framework.QTC_GroupLoader {
                id: tb_btn5
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: main_toolbar.buttonName; obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("gear")
                obj: "QTCtoolbarbutton"
                onClicked: {
                    console.log("gear")
                    flick_toolbar.toolbarEvent(5)
                }
            }

            Framework.QTC_GroupLoader {
                id: tb_ghost4
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: QTCtools.getButton("ghost")
                enabled: false
                obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("ghost")
                obj: "QTCtoolbarbutton"
            }

            Framework.QTC_GroupLoader {
                id: tb_ghost5
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: QTCtools.getButton("ghost")
                enabled: false
                obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("ghost")
                obj: "QTCtoolbarbutton"
            }

            Framework.QTC_GroupLoader {
                id: tb_ghost6
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: QTCtools.getButton("ghost")
                enabled: false
                obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("ghost")
                obj: "QTCtoolbarbutton"
            }

            Framework.QTC_GroupLoader {
                id: tb_btn6
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: main_toolbar.buttonName; obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("info")
                obj: "QTCtoolbarbutton"
                onClicked: {
                        console.log("info")
                    flick_toolbar.toolbarEvent(6)
                }
            }

            Framework.QTC_GroupLoader {
                id: tb_btn7
                width: main_toolbar.buttonSize; height: main_toolbar.buttonSize
                obj_button: main_toolbar.buttonName; obj_color: main_toolbar.obj_color
                obj_icon: QTCtools.getIcon("help")
                obj: "QTCtoolbarbutton"
                onClicked: {
                    console.log("help")
                    flick_toolbar.toolbarEvent(7)
                }
            }
        }
    }
}

